package com.yiyang.cloud.controller;

import com.yiyang.cloud.entity.User;
import com.yiyang.cloud.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/users")
public class UserController {

    @Autowired
    private UserService userService;
    @Value("${server.port}")
    private Integer port;

    @GetMapping("/{id}")
    public User findByUserId(@PathVariable("id") Long id) {
        System.out.println("获取用户信息接口调用，端口为：" + port);
        return userService.findByUserId(id);
    }
}
